//
//  AppDelegate.swift
//  DWater-Swift
//
//  Created by mac on 2017/4/17.
//  Copyright © 2017年 Dimon.胡亚宾. All rights reserved.
//

import UIKit
import IQKeyboardManagerSwift
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        self.addIQkeyboardManager()
        self.window = UIWindow(frame: MAIN_BOUNDS)
        let test = DWChoseDWaterController()
        let nav = BaseNaviViewController(rootViewController:test)
        self.window?.rootViewController = nav
        self.window?.makeKeyAndVisible()
        
        if (DWUserManager.shared.userInfo) == nil {
            self.needToLogin()
        }
        self.window?.makeKeyAndVisible()

        return true
    }
    
    func addIQkeyboardManager() -> () {
        
        IQKeyboardManager.sharedManager().enable = true
        IQKeyboardManager.sharedManager().toolbarDoneBarButtonItemText = "完成"
    }
 
    func needToLogin(){
      
        DWLoginViewController.loginWithVC(vc: (self.window?.rootViewController)! , animated: true) {
        print("跳起来了")
        }
    }
    
}

